home *** CD-ROM | disk | FTP | other *** search
- #include "FD Interface.h"
-
- /*****
- * This is the module's main entrypoint.
- *****/
- Boolean ModuleMain( short message, ModuleDataRec *moduleData)
- {
- Boolean returnValue = TRUE;
-
- switch (message)
- {
- case eStartup :
- // The application just started. Set up any custom
- // stuff you want.
- SetStatusParams( TRUE, TRUE, "\pMoof!");
- returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
- // you will receive an eQuitting message and File Dropper
- // will quit. You will NOT get an eDispose message.
- break;
-
- case eSFInitialize :
- /*
- * The SFGetFile is about to be brought up - you can install your own at this point
- * if you want to.
- * If the user chooses a file, you will receive one each of eValidate and eProcessFile
- * messages. If s/he chooses a folder, you will receive an eValidate and eProcessFile
- * message for each file in the folder, and each file in each folder on down the line.
- * NOTE: you only get one of these for each time the SFGetFile dialog comes up. If
- * you want to initialize something before each file, do it in the eProcessFile case.
- */
-
- returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
- // you will receive an eQuitting message and File Dropper
- // will quit. You will NOT get an eDispose message.
- break;
-
- case eAEInitialize :
- // An 'odoc' AppleEvent has been received - you are about to be flooded with
- // eValidateFile and eProcessFile messages (a set for each file you need to process)
- // NOTE, you only get one eAEInitialize for the whole batch of files. If you want to
- // initialize something before each file, do it in the eProcessFile case.
-
- returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
- // you will receive an eQuitting message and File Dropper
- // will quit. You will NOT get an eDispose message.
- break;
-
- case eValidateFile :
- SetStatusParams( TRUE, TRUE, NULL);
- // validate the file here
- returnValue = TRUE; // TRUE means theFile in moduleData is one that
- // you want to process
- break;
-
- case eProcessFile :
- // Do your stuff - theFile in moduleData is the file
- // you need to process
- // Here, I simply am showing off the progress bar stuff.
- {
- short i;
-
- ChangeStatusMessage( moduleData->theFile->name);
- for ( i=0; i <= 50; i++) SetStatusPercentage( i);
-
- ChangeStatusMessage( "\pProcessing phase 2");
- for ( ; i >= 25; i--) SetStatusPercentage( i);
-
- ChangeStatusMessage( "\pFinishing up");
- for ( ; i <= 100; i++) SetStatusPercentage( i);
- }
-
- returnValue = TRUE; // return TRUE to continue processing any remaining files,
- // or FALSE to stop prematurely
- break;
-
- case eUserCancelled :
- // The user clicked Cancel in the satatus dialog. Since File
- // Dropper handles the status dialog whenever you call
- // SetStatusPercentage, you will get this message only during
- // a call to SetStatusPercentage.
- // moduleData->theFile is the file that was being processed
- // when the user clicked Cancel.
-
- returnValue = TRUE; // Return TRUE to receive an eDispose, an eQuitting message, and
- // have File Dropper ExitToShell.
- // Return FALSE to pretend the Cancel didn't get clicked, although
- // you could keep track and immediately return FALSE from the
- // eProcessFile case.
- break;
-
- case eDispose :
- // If you allocated any storage in eSFInitialize or
- // eAEInitialize, dispose of it here.
-
- returnValue = FALSE; // return FALSE if you want File Dropper to send you an
- // eQuitting message and quit.
- // TRUE means you want to keep running
- break;
-
- case eDoAboutBox :
- // Give yourself some credit.
-
- // returnValue is ignored for this message
- break;
-
- case eQuitting :
- // The application is about to quit, save anything
- // that needs to be saved.
-
- // returnValue is ignored for this message
- break;
-
- case eIdle :
- // You can do whatever you want, including nothing, here.
- // It's continuously called when there are no files to process
- // and File Dropper is receiving NULL events.
-
- // returnValue is ignored for this message
- break;
- }
-
- return returnValue;
- }
-
-
-
-
-
-
-
-